package com.arpa.wms.domain.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;

import java.util.HashMap;
import java.util.Map;

/**
 * 盘点单类型 枚举类型
 * @author jinss
 * @date 2020-11-30 11:13:42
 **/
public enum CountingTypeEnum implements IEnum<String> {
    /**
     * 盘点单类型
     */
    ALL("0", "全盘"),
    SHIPMENT("1", "货主盘点"),
    LOCATION("2", "库位盘点"),
    ACTIONNUM("3", "动碰盘点");


    /**
     * 值
     */
    private final String value;

    /**
     * 描述
     */
    private final String desc;

    CountingTypeEnum(final String value, final String desc) {
        this.value = value;
        this.desc = desc;
    }

    private static final Map<String, CountingTypeEnum> ENUM_MAP = new HashMap();

    static {
        CountingTypeEnum[] values = values();
        int length = values.length;
        for(int i = 0; i < length; i++){
            CountingTypeEnum value1 = values[i];
            ENUM_MAP.put(value1.getValue(), value1);
        }
    }

    /**
     * 根据值获取枚举对象
     * @param value
     * @return
     */
    public static CountingTypeEnum getEnumByValue(String value){
        return ENUM_MAP.get(value);
    }

    public static String translate(String value) {
        CountingTypeEnum item = ENUM_MAP.get(value);
        if (item != null) {
            return item.getDesc();
        }
        return null;
    }

    @Override
    public String getValue() {
        return this.value;
    }

    @Override
    public String toString(){
        return this.desc;
    }

    public String getDesc() {
        return this.desc;
    }
}
